﻿using Autofac;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DTM.WinApp.Bootstrapper
{
    public static class AutofacConfig
    {
        #region Properties

        /// <summary>
        /// IoC container.
        /// </summary>
        public static IContainer Container { get; private set; }

        #endregion Properties

        #region Methods

        public static void ConfigureContainer()
        {
            if (Container == null)
            {
                var builder = new ContainerBuilder();

                builder.RegisterModule(new DTM.Repository.Bootstrapper.RegistrationModule());
                builder.RegisterModule(new DTM.Domain.Bootstrapper.RegistrationModule());
                builder.RegisterModule(new DTM.WinApp.Bootstrapper.RegistrationModule());

                Container = builder.Build();
            }
        }

        #endregion Methods
    }
}